package edu.jd.movieplatform.admin.a_cinema;

import edu.jd.movieplatform.common.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController//表示为Spring容器管理对象，且为控制器组件
@RequestMapping("/admin/a_cinema")//路径定义
public class a_CinemaAPI {

    //引入依赖
    @Resource//从容器中引入依赖
    private a_CinemaService a_cinemaService;

    @GetMapping("")
    public Result a_cinemaList(a_CinemaDto dto){
        Map<String,Object> page =  a_cinemaService.geta_CinemaList(dto);
        return Result.success(page);
    }

    @PostMapping("")
    public Result cinemaAdd(@RequestBody a_CinemaDto dto) {
        a_cinemaService.addCinema(dto);
        return Result.success();
    }

    @PutMapping("")
    public Result cinemaUpd(@RequestBody a_CinemaDto dto){
        a_cinemaService.updCinema(dto);
        return Result.success();
    }

    @DeleteMapping("/{id}")
    public Result cinemaDelete(@PathVariable Integer id){
        a_cinemaService.deleteCinema(id);
        return Result.success();
    }

}
